//
// Created by Suny on 14-11-18.
// Copyright (c) 2014 Suny. All rights reserved.
//

#import "SelectTableViewCell.h"
#import "SelectTableViewController.h"
#import "UIImageView+WebCache.h"


@implementation SelectTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self)
	{
		self.imageHoderName = @"RongCloud.bundle/default_portrait";
	}
	return self;
}

- (void)setItem:(NSObject <SelectTableViewItemDelegate> *)item
{
    _item = item;

    if ([item respondsToSelector:@selector(selectTableViewItemImageUrlString)])
    {
        [self.imageView setQNImageWithURL:[NSURL URLWithString:[item selectTableViewItemImageUrlString]]
                       placeholderImage:[UIImage imageNamed:self.imageHoderName]];
		
		self.imageView.hidden = NO;
    }
	else 
	{
		self.imageView.hidden = YES;
	}

    if ([item respondsToSelector:@selector(selectTableViewIteNameString)])
    {
        self.textLabel.text = [item selectTableViewIteNameString];
    }

    if ([item respondsToSelector:@selector(selectTableViewItemDetailInfoString)])
    {
        self.detailTextLabel.text = [item selectTableViewItemDetailInfoString];
    }
	
	self.bottomLineHidden = NO;

}
@end